import React from 'react'
import { Input, Select, DatePicker, Space, Button, Row, Col } from 'antd'
import { SearchOutlined } from '@ant-design/icons';
import Tabs from '../../../components/afterLoan/tabs'
import List from '../../../components/afterLoan/List';
import { Link } from 'react-router-dom';
import Bread from '../../../components/Bread';

const columns = [
    {
        title: '借款编号',
        dataIndex: 'borrow_num',
    },
    {
        title: '姓名',
        dataIndex: 'name',
    },
    {
        title: '合同号',
        dataIndex: 'contract_num',
    },
    {
        title: '合同金额',
        dataIndex: 'contract_money',
    },
    {
        title: '借款期限',
        dataIndex: 'borrow_term',
    },
    {
        title: '贷款类型',
        dataIndex: 'loan_type',
    },
    {
        title: '还款方式',
        dataIndex: 'payment_method',
    },
    {
        title: '放款时间',
        dataIndex: 'loan_time',
    },
    {
        title: '放款方式',
        dataIndex: 'loan_method',
    },
    {
        title: '还款状态',
        dataIndex: 'status',
    },
    {
        title: '是否结项',
        dataIndex: 'isFinish',
    },
    {
        title: '结项时间',
        dataIndex: 'finish_time'
    },
    {
        title: '贷款评分',
        dataIndex: 'loan_score'
    },
    {
        title: '风控结项评语',
        dataIndex: 'remark'
    },
    {
        title: '操作',
        key: 'action',
        render: (text, record) => (
            <Space>
                <Link to={
                    {
                        pathname: "/home/afterloan/finishcheck",
                        name: record.name,
                        state: 1
                    }
                }>查看</Link>
                <Link to={
                    {
                        pathname: "/home/afterloan/finishcheck",
                        name: record.name,
                        state: 2
                    }
                }>结项办理</Link>
            </Space>
        )
    }
];

const data = [];
for (let i = 0; i < 46; i++) {
    data.push({
        borrow_num: i,
        key: i,
        name: `Edward King ${i}`,
        contract_num: i,
        contract_money: 40000,
        borrow_term: 12,
        loan_type: '个人信用',
        payment_method: '等本等息',
        loan_time: '2021-12-28',
        loan_method: '线下放款',
        status: '已还清',
        isFinish: '未结项',
        finish_time: '-',
        loan_score: '-',
        remark: '-'
    });
}

export default function Finish() {
    const Search = (
        <div className='after-search'>
            <Row gutter={{ xs: 8, sm: 16, md: 24, lg: 32 }}>
                <Col className="gutter-row" span={6}>
                    <div>
                        <Input placeholder="借款编号" />
                    </div>
                </Col>
                <Col className="gutter-row" span={6}>
                    <div>
                        <Input placeholder="姓名/手机号" />
                    </div>
                </Col>
                <Col className="gutter-row" span={6}>
                    <div>
                        <Input placeholder="合同号" />
                    </div>
                </Col>
                <Col className="gutter-row" span={4}>
                    <div>
                        <Button icon={<SearchOutlined />} type='button' >
                            查询
                        </Button>
                    </div>
                </Col>
            </Row>
        </div>
    )
    return (
        <div className='finish'>
            <Bread bread_title1="贷后管理" bread_title2="贷款结项" />
            {Search}
            <List data={data} columns={columns} isExportBtn={true} />
        </div>
    )
}
